package com.jubaopen.dao.ibatis;

import java.util.List;
import java.util.Map;

import com.jubaopen.bean.InviteCode;
import com.jubaopen.dao.InviteCodeDAO;

public class InviteCodeDAOImpl extends BaseIBatisDao implements InviteCodeDAO {

	@Override
	public int add(InviteCode inviteCode) {
		return (Integer) this.getSqlMapClientTemplate().insert(
				"InviteCodeMapper.insert", inviteCode);
	}

	@Override
	public InviteCode getByCode(String code) {
		return (InviteCode) this.getSqlMapClientTemplate().queryForObject(
				"InviteCodeMapper.getByCode", code);
	}

	@Override
	public int getCount(Map<String, Object> map) {
		return (Integer) this.getSqlMapClientTemplate().queryForObject(
				"InviteCodeMapper.getCount", map);
	}

	@Override
	public int update(InviteCode inviteCode) {
		return this.getSqlMapClientTemplate().update("InviteCodeMapper.update",
				inviteCode);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<InviteCode> getPagedList(Map<String, Object> map) {
		return this.getSqlMapClientTemplate().queryForList(
				"InviteCodeMapper.getPagedList", map);
	}

	@Override
	public int getNoActiveCount(Map<String, Object> map) {
		return (Integer) this.getSqlMapClientTemplate().queryForObject(
				"InviteCodeMapper.getNoActiveCount", map);
	}

}
